package com.qyl.hrm.utils;

import java.util.List;

public class PageBean {
	//当前页数
	private Integer pageIndex;
	//总记录数
	private Integer recordCount;
	//每页显示条数
	private Integer pageSize;
	//总页数
	private Integer totalPage;
	//分页列表数据
	private List	list;
	public PageBean(Integer pageIndex, Integer recordCount, Integer pageSize) {
		this.recordCount = recordCount;
		
		this.pageSize =  pageSize;
		
		this.pageIndex = pageIndex;
		
		if(this.pageIndex == null){
			//如页面没有指定显示那一页.显示第一页.
			this.pageIndex = 1;
		}
		
		if(this.pageSize == null){
			//如果每页显示条数没有指定,默认每页显示3条
			this.pageSize = 3;
		}
		
		//计算总页数
		this.totalPage = (this.recordCount+this.pageSize-1)/this.pageSize;
		
		//判断当前页数是否超出范围
		//不能小于1
		if(this.pageIndex < 1){
			this.pageIndex = 1;
		}

		
	}
	//计算起始索引
	public int getStart(){
		return (this.pageIndex-1)*this.pageSize;
	}
	
	public Integer getpageIndex() {
		return pageIndex;
	}
	public void setpageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}
	public Integer getrecordCount() {
		return recordCount;
	}
	public void setrecordCount(Integer recordCount) {
		this.recordCount = recordCount;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public Integer getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	public List getList() {
		return list;
	}
	public void setList(List list) {
		this.list = list;
	}
	
	
	
	
	
	
}
